package lk.icta.core.service;

import lk.icta.common.entity.Document;
import lk.icta.common.entity.GNDivision;
import lk.icta.core.entity.Kachchery;
import lk.icta.core.entity.Land;
import lk.icta.core.entity.LandAssociation;
import lk.icta.user.entity.User;

import java.util.List;
import java.util.Set;

/**
 * @author Supun Nimesh Karunathilaka
 */
public interface LandAssociationManagementService {

    /**
     * Add Land Alienation Method Metadata
     *
     * @param landAssociation Alienation Metadata to be persisted
     * @param user            user who performs this action
     */
    public void addLandAlienationMetadata(LandAssociation landAssociation,long landId, boolean isDefineAM, User user);

    /**
     * Update Land Alienation Method Metadata
     *
     * @param landAssociation Alienation Metadata to be updated
     * @param user            user who performs this action
     */
    public void updateLandAlienationMetadata(LandAssociation landAssociation,long LandId, boolean isDefineAM, User user);

    /**
     * return all alienation method meta data corresponding to given land id
     *
     * @param id   land id
     * @param user user performong the operation
     * @return LandAssociation list
     */
    public List<LandAssociation> getAllAlienationMethodMetadataByLand(long id, User user);

    /**
     * return a alienation method meta data corresponding to given metadata id
     *
     * @param id   metadata id
     * @param user user performong the operation
     * @return LandAssociation
     */
    public LandAssociation getAlienationMethodMetadataById(long id, User user);

    /**
     * Approve Land Alienation Method Metadata
     *
     * @param landAssociation Alienation Metadata to be approved
     * @param user            user who performs this action
     */
    public void approveLandAlienationMetadata(LandAssociation landAssociation, User user);

    /**
     * Approve Land Alienation Method Metadata
     *
     * @param metadataId Alienation Metadata ID to be approved
     * @param user       user who performs this action
     * @param id
     */
    public void approveLandAlienationMetadata(long metadataId, String defineComment, User user, long id);

    /**
     * Approve Land Alienation Method MetadataForDefineAM
     *
     * @param metadataId Alienation Metadata ID to be approved
     * @param user       user who performs this action
     * @param la         landAssociation (Needed for checking version)
     */
    public void approveLandAlienationMetadataForDefineAM(long metadataId, String defineComment, User user, LandAssociation la);

    /**
     * Reject Land Alienation Method Metadata
     *
     * @param metadataId         Alienation Metadata ID to be rejected
     * @param associationComment comment about reject
     * @param user               user who performs this action
     * @param id                  land Id
     * @param la                  landAssociation (Needed for checking version)
     */
    public void rejectLandAlienationMetadata(long metadataId, String associationComment, boolean isDefineAM, User user, long id, LandAssociation la);

    /**
     * Reject Land Alienation Method MetadataForDefineAM
     *
     * @param metadataId         Alienation Metadata ID to be rejected
     * @param associationComment comment about reject
     * @param user               user who performs this action
     */
    public void rejectLandAlienationMetadataForDefineAM(long metadataId, String associationComment, User user);

    /**
     * return all not approved alienation method meta data corresponding to given land id
     *
     * @param id   land id
     * @param user user performong the operation
     * @return LandAssociation list
     */
    public List<LandAssociation> getAllNotApprovedAlienationMethodMetadataByLand(long id, User user);

    /**
     * return all alienation method meta data corresponding to given land id
     *
     * @param id   land id
     * @param user user performong the operation
     * @return LandAssociation list
     */
    public List<LandAssociation> getAlienationMethodMetadataListByLand(long id, User user);

    /**
     * return all alienation method meta data corresponding to given land id
     *
     * @param id   land id
     * @param user user performong the operation
     * @return LandAssociation
     */
    public LandAssociation getAlienationMethodMetadataByLand(long id, User user);

    /**
     * returns all alienation method metadata by alienation methos
     *
     * @param id   Alienation Method id
     * @param user user performing the operation
     * @return LandAssociation list
     */
    public List<LandAssociation> getAllAlienationMethodMetadataByAlienationMethod(int id, User user);

    public List<lk.icta.core.entity.LandAssociation> getAllApprovedDefineAlienationMethodMetadataByUser(User user);

    public List<lk.icta.core.entity.LandAssociation> getAllApprovedDefineAlienationMethodMetadataByUserAndMethodId(int id, User user);

    public List<lk.icta.core.entity.LandAssociation> getAllApprovedDefineAlienationMethodMetadataByDs(int dsId, User user);

    public List<lk.icta.core.entity.LandAssociation> getAllApprovedDefineAlienationMethodMetadataByDistrict(int districtId, User user);

    public void addLandKachcheryMatadata(lk.icta.core.entity.LandAssociation landAssociation, User user);

    public void updateLandKachcheryMatadata(lk.icta.core.entity.LandAssociation landAssociation, User user);

    public void approveLandKachcheryMatadata(lk.icta.core.entity.LandAssociation landAssociation, User user);

    public void saveLandKachchery(List<LandAssociation> landAssociationList, Kachchery kachchery, User user);

    /**
     *update the land association for define Alienation method
     *
     * @param alienationMethod   Alienation Method id
     * @param addedDocs added documents
     * @param landAssociation landAssociation
     * @param land land
     * @param deleteDocList documents to be deleted
     * @param user user performing the operation
     * @return LandAssociation list
     */
    public void updateLandAssociationForDefineAM(int alienationMethod,List<Document> addedDocs,LandAssociation landAssociation, Land land, List<Long> deleteDocList, User user) ;
}
